//headers 
#include<algorithm>
#include<cassert>
#include<cstdio>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<deque>
#include<set>
#include<string>
#include<sstream>
#include<stack>
#include<streambuf>
#include<vector>
using namespace std;

//macros
#define LET(x,a) typeof(a) x(a)
#define FOR(i,a,n) for(LET(i,a);i!=n;i++)
#define REP(i,n) FOR(i,0,n)
#define sz size()
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define dbge(x) cout<<#x<<"->"<<x<<endl;
#define PRINT(x) REP(i,x.sz) cout<<(x[i])<<endl;
#define OUT(x) x<<" "
#define LL long long
#define VI vector<int>
#define VS vector<string>

//code of suren

LL fact[1001];



int main(){
	fact[0]=1;
	FOR(i,1,1001) fact[i]=(fact[i-1]*i)%1000000007;
	int t;
	cin>>t;
	REP(i,t){
		int N,M,K;
		cin>>N>>M>>K;
		LL c = comb(M,K);
		LL perm = fact[N-K];
		cout<<comb<<" "<<perm<<endl;
		LL ans = comb*perm - 1;
		cout<<"Case "<< i+1 <<": "<<ans<<endl;
	}
  return 0;
}
